﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Cosoware.Web.Documents
{
    public class DocumentsRepository
    {
        static public RepositoryProvider Provider { get; set; }

        /// <summary>
        /// Gets the document by identifier.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        static public Document GetDocument(Guid id)
        {
            return Provider.GetDocument(id);
        }

        /// <summary>
        /// Saves the document.
        /// </summary>
        /// <param name="document">The document.</param>
        static public void SaveDocument(Document document)
        {
            Provider.SaveDocument(document);
        }

        /// <summary>
        /// Finds the documents.
        /// </summary>
        /// <param name="predicate">The predicate.</param>
        /// <returns>The documents.</returns>
        static public IEnumerable<Document> FindDocuments(Func<Document, bool> predicate)
        {
            return Provider.FindDocuments(predicate);
        }

        /// <summary>
        /// Counts the documents.
        /// </summary>
        /// <param name="predicate">The predicate.</param>
        /// <returns>The count of documents.</returns>
        static public int CountDocuments(Func<Document, bool> predicate)
        {
            return Provider.CountDocuments(predicate);
        }
    }
}
